package com.aaa.ssm.controller;

import com.aaa.ssm.entity.ScenicDot;
import com.aaa.ssm.service.ScenicDotService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("dot")
public class ScenicDotController extends BaseController{
    @Resource
    private ScenicDotService scenicDotService;

    /**
     * 查询所有
     * @return
     */
    @GetMapping("queryAll")
    public Result queryAll(){
        return success(scenicDotService.queryAll());
    }

    /**
     * 分页带参查询
     * @param page
     * @return
     */
    @PostMapping("queryPage")
    public Result queryPage(@RequestBody Page<ScenicDot> page){
        return success(scenicDotService.queryPage(page));
    }

    /**
     * 添加数据
     * @param scenicDot
     * @return
     */
    @PostMapping("add")
    public Result add(@RequestBody ScenicDot scenicDot){
        return success(scenicDotService.add(scenicDot));
    }

    /**
     * 更新数据
     * @param scenicDot
     * @return
     */
    @PostMapping("update")
    public Result update(@RequestBody ScenicDot scenicDot){
        return  success(scenicDotService.update(scenicDot));
    }

    /**
     * 根据编号删除数据
     * @param id
     * @return
     */
    @DeleteMapping("delete/{id}")
    public Result deleteById(@PathVariable("id")int id){
        return  success(scenicDotService.deleteById(id));
    }
}
